# 第一遍
from selenium import webdriver
from selenium.webdriver.common.by import By
import time

class TestCase:
    def __init__(self):
        # 打开浏览器
        self.driver = webdriver.Chrome()

    def get_baidu(self):
        # 点击进入百度
        self.driver.get('http://www.baidu.com')
        # 搜索框搜索天气预报
        self.driver.find_element(By.ID,'kw').send_keys('天气预报')
        # 点击百度一下
        self.driver.find_element(By.ID,'su').click()

    def quit(self,seconds=2):
        # 关闭退出
        time.sleep(seconds)
        self.driver.quit()

if __name__ == '__main__':
    case = TestCase()
    case.get_baidu()
    case.quit()

# 第二遍
from selenium import webdriver
from selenium.webdriver.common.by import By
import time

class TestCase:
    def __init__(self):
        # 打开浏览器
        self.driver = webdriver.Chrome()

    def get_baidu(self):
        # 点击进入百度
        self.driver.get('http://www.baidu.com')
        # 搜索框搜索天气预报
        self.driver.find_element(By.ID,'kw').send_keys('天气预报')
        # 点击百度一下
        self.driver.find_element(By.ID,'su').click()

    def quit(self,seconds=2):
        # 关闭退出
        time.sleep(seconds)
        self.driver.quit()

if __name__ == '__main__':
    case = TestCase()
    case.get_baidu()
    case.quit()

# 第三遍
from selenium import webdriver
from selenium.webdriver.common.by import By
import time

class TestCase:
    def __init__(self):
        # 打开浏览器
        self.driver = webdriver.Chrome()

    def get_baidu(self):
        # 点击进入百度
        self.driver.get('http://www.baidu.com')
        # 搜索框搜索天气预报
        self.driver.find_element(By.ID,'kw').send_keys('天气预报')
        # 点击百度一下
        self.driver.find_element(By.ID,'su').click()

    def quit(self,seconds=2):
        # 关闭退出
        time.sleep(seconds)
        self.driver.quit()

if __name__ == '__main__':
    case = TestCase()
    case.get_baidu()
    case.quit()